
import format from 'date-fns/format';
// 时间格式化
export function timer(){
    let time = new Date()
    let nowtime = format(time, 'yyyy-MM-dd_HH:mm:ss')
    return nowtime
}
// 根据目标value查询数组对象里对应的key

export function findKeyByValue(objArray, targetValue){
    const findObject = objArray.find(obj => Object.values(obj).includes(targetValue))
    if(findObject){
        return Object.keys(findObject)[0]
    }else {
        return null
    }
}
// 示例对象数组
// const array = [
//     { key1: 'value1' },
//     { key2: 'value2' },
//     { key3: 'value3' }
//   ];
  
//   const targetValue = 'value2';
// 输出 key2
